package com.jic.syncdata.manager;

import java.sql.*;

/**
 * Desc:
 *
 * @author wulei19922@gmail.com
 * create:2020/12/1
 **/
public class MerchanManager  implements  ConnectManager {
    public static String url = "jdbc:mysql://139.217.225.3:3306/bbc_manager";
    public static String username = "root";
    public static String password = "2wsgsda%lptP!3sd5rti";


    public  Connection getConnection() throws ClassNotFoundException {
        Connection conn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        try {
            conn = DriverManager.getConnection(url, username, password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }

    public static void close(Connection conn, PreparedStatement preparedStatement, ResultSet rs) {
        try {
            //关闭结果集
            rs.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        try {
            //关闭编译通道
            preparedStatement.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        try {
            //关闭连接
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }


}
